{include header}
<div id="primary" class="content-area">
  <div id="content" class="site-content" role="main">

      <link href="{#WWW}/public/css/simditor.css" type="text/css" rel="stylesheet">
      <style>
      .simditor .simditor-toolbar > ul > li > .toolbar-item {
          display: table-cell;
          width: 40px;
          height: 40px;
          outline: none;
          color: #333333;
          font-size: 15px;
          line-height: 40px;
          vertical-align: middle;
          text-align: center;
          text-decoration: none;
      }
      </style>

      <label style="display:block;font-size:18px">标题 <span></span></label>

      <select id="forum" type="text" class="text " style="width:150px;margin-bottom:10px">
      <option value="-1">请选择一个分类</option>

      {foreach $forum as $v}
      <option value="{$v['id']}">{$v['name']}</option>
      {/foreach}
      </select>
      <input style="display:block;width:100%" type="text" id="title" placeholder="请填写标题">
      <label style="display:block;font-size:18px">发表内容 <span></span></label>
      <textarea id="editor" autofocus></textarea>
      <button type="button" class="btn btn-primary" id="post1"><i class="am-icon-check"></i> 发 表</button>
      <script src="{#WWW}/public/js/edit.min.js"></script>

      <script>
      $(function(){
          $("#post1").click(function(){
              var forum = $("#forum").val();


              $.ajax({
               url: '{#WWW}/post.html',
               type:"POST",
               cache: false,
               data:{title:$("#title").val(),content:editor.textarea.val(),forum:forum},
               dataType: 'json'
           }).then(function(e) {

               alert(e.info);
               if(e.error)
                  window.location.href="{#WWW}/thread/"+e.id+".html";
             }, function() {
               alert('请尝试重新提交');
             });
          })
      })
      </script>
  </div>
</div>
{include menu}
{include footer}
